In [27]:
from clifford import * #from https://bitbucket.org/robertkern/clifford

pretty()
layout, blades = Cl(3,1)
rb = lambda g:randomMV(layout, grades=[g])

Conformal Space

Vectors in the orignal space are mapped to vectors in conformal space through the map:

$X = x + \frac{1}{2} x^2 e_{\infty} +e_o $

The inverse map is the made by normalizing the conformal vector, then rejection from the minkowski plane $E_0$,

$ X = \frac{X}{X \cdot e_{\infty}}$

then

$x = X \wedge E_0\, E_0^{-1}$


In [28]:
e0,e1,e2,e3 = [blades['e%i'%k] for k in range(4)]

# setup  null basis, and minkowski subspace bivector
eo = .5^(e3-e2)
einf= e2+e3
E0= einf^eo


v4 =  lambda : rb(1)
def v2():
    x=v4()
    return x- E0.project(x)
up = lambda x: x + (.5^((x**2)&einf)) + eo
homo = lambda x: x & (-x*einf).normalInv()
down = lambda x: (homo(x)^E0)&E0

c2v = lambda x: (x.real&e0) + (x.imag&e1) # complex2vector
v2c = lambda x: float(x*e0)+ float(x*e1)*1j

In [29]:
eo^einf == -E0


Out[29]:
True

In [30]:
einf&eo


Out[30]:
-1.0 + (1.0^e23)

In [31]:
einf-(2^eo)


Out[31]:
(2.0^e2)

In [32]:
x = v2()
x


Out[32]:
-(1.78788396954^e0) + (1.62796187463^e1)

In [33]:
X=up(x)
X


Out[33]:
-(1.78788396954^e0) + (1.62796187463^e1) + (2.42339447689^e2) + (3.42339447689^e3)

In [34]:
x = v2()
X = up(x)
assert(X**2 ==0)
assert(down(X) ==x)

Operations

Conformal transformations in $G^n$ are achieved through versers in the conformal space $G^{n+1,1}$. These versers can be categorized by their relation to the minkowski plane, $E_0$. There are three categories,

  • verser purley in $E_0$
  • verser partly in $E_0$
  • verser out of $E_0$

In [35]:
from IPython.display import Image,SVG
Image('pics/conformal space.png')


Out[35]:

Versers purely in $E_0$


In [36]:
eps(1e-13)
a = v2()
b = v2()

Inversions

$ e_+ X e_+$

Inversion is a reflection in hyperplane normal to $e_-$, this swaps $e_o$ and $e_{\infty}$


In [37]:
assert(down(e2&up(a)&e2)  == a.inv())

Involutions

$E_0 X E_0$


In [38]:
assert(down(E0&up(a)&E0) == -a)

Dialations

$D_\alpha = e^{-\frac{\ln{\alpha}}{2} \,E_0} $

$D_\alpha \, X \, \tilde{D_\alpha} $


In [39]:
D = lambda alpha: e**((-log(alpha)/2.)&(E0)) 
alpha = rand()
assert(down( D(alpha)&up(a)&~D(alpha)) == (alpha&a))

Versers partly in $E_0$

Translations


In [40]:
T = lambda x: e**(1/2.&(einf&x)) 
assert(down( T(a)&up(b)&~T(a)) == b+a)

Transversions

A transversion is an inversion, followed by a translation, followed by a inversion.


In [41]:
down(e2&T(b)&e2&up(a)&e2&~T(b)&e2) == 1/(b+1/a)


Out[41]:
True

Versers Out of $E_0$

Versers that are out of $E_0$ are made up of the versers within the original space. These include reflections and rotations, and their conformal representation is identical to their form in $G^n$

Reflections


In [42]:
m = v2()
m = m/abs(m)
assert(down(m&up(a)&m) == -m&a&m)

Rotations


In [43]:
R = lambda theta: e**((-.5*theta)&(e0^e1))
theta = pi/2
assert(down( R(theta)&up(a)&~R(theta)) == R(theta)&a&~R(theta))

In [44]:
a,b = v2(),v2()

down(up(a)&up(b))


Out[44]:
(0.0951488812149^e0) - (0.18092211443^e1)

Combinations of Operations

simple example

As a simple example consider the combination operations of translation,scaling, and inversion.

$b=-2a+e_0$


In [45]:
A = up(a)
Q = T(e0)&E0&D(2)
B = Q&A&~Q
assert(down(B) == (-2&a)+e0 )

Transversion

A transversion may be built from a inversion, translation, and inversion.

$a^{'} = (a^{-1}+b)^{-1}$


In [46]:
A = up(a)
Q = e2&T(b)&e2
B = Q&A&~Q
assert(down(B) ==1/(1/a +b))

In [47]:
c=((1/a)+b)
c.rightInv??

Circuit Representation Transforma: Impedance and Scattering

$s = \frac{z-1}{z+1} = -1( 2(z+1)^{-1})+1$

Note that if z is interpreted as a spinor (complex number), then the spinor inversion translates to inversion + reflection about real axis.


In [83]:
z = v2()

Z = up(z)
Q = T(e0) & E0 & D(2)& e0 & e2 & T(e0)
S = Q&Z&~Q
s = down(S)

#assert(s == (z+e0).inv()&(z-e0))
s,e0&((z+e0).inv()&(z-e0))


Out[83]:
((0.606209176767^e0) - (1.08410842291^e1),
 (1.39379082323^e0) + (1.08410842291^e1))

In [90]:
z_ = v2c(z)

(z_-1)/(z_+1)


Out[90]:
(1.3937908232325744+1.0841084229057876j)

Rotation about a point

Rotation about a point, $a$ can be achieved by translating the origina to $a$ then rotating, then translating back. This composition of operations can also be thought of as translating the Rotor itself.


In [49]:
r = R(pi/2.)

Q =T(a)&r&~T(a)

B= up(b)
C=Q&B&~Q
c=down(C)

c


Out[49]:
-(1.0002496811^e0) + (0.88720206268^e1)

Embedding a network

$m = e_{00}+ e_{01}(a^{-1}-e_{11})^{-1}$


In [51]:
e11, e00, e01 = v2(),v2(),v2()

from math import atan
theta= atan((e01*e1)/(e01*e0))

Q = T(e00) & D(abs(e01)) & R(theta) & e2& T(e11) & e2
Q =  D(abs(e01)) & R(theta)

A= up(a)
M = Q&A&~Q
m= down(m)


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-51-13cefb1b782f> in <module>()
      9 A= up(a)
     10 M = Q&A&~Q
---> 11 m= down(m)

<ipython-input-28-e29bb98b604d> in <lambda>(x)
     13 up = lambda x: x + (.5^((x**2)&einf)) + eo
     14 homo = lambda x: x & (-x*einf).normalInv()
---> 15 down = lambda x: (homo(x)^E0)&E0
     16 
     17 c2v = lambda x: (x.real&e0) + (x.imag&e1) # complex2vector

<ipython-input-28-e29bb98b604d> in <lambda>(x)
     12     return x- E0.project(x)
     13 up = lambda x: x + (.5^((x**2)&einf)) + eo
---> 14 homo = lambda x: x & (-x*einf).normalInv()
     15 down = lambda x: (homo(x)^E0)&E0
     16 

/home/alex/data/docs/code/path/clifford.pyc in normalInv(self)
   1296             return Madjoint / MadjointM[()]
   1297         else:
-> 1298             raise ValueError, "no inverse exists for this multivector"
   1299 
   1300     leftInv = leftLaInv

ValueError: no inverse exists for this multivector

In [61]:
a,b


Out[61]:
(-(0.0951488812149^e0) + (0.18092211443^e1),
 (0.611131067035^e0) + (1.08602291431^e1))

In [62]:
A,B = up(a),up(b)

In [64]:
A&B


Out[64]:
-0.659019411623 - (0.213900990112^e01) + (0.26649194472^e02) - (0.43978800353^e03) + (0.570339471251^e12) - (0.33476132863^e13) - (0.755570415209^e23)

In [66]:
a&b


Out[66]:
0.138337124673 - (0.213900990112^e01)

In [67]:
down(A&B)


Out[67]:
(0.0951488812149^e0) - (0.18092211443^e1)

In [69]:
(a+b).inv(), a.inv()+b.inv()


Out[69]:
((0.275721749192^e0) + (0.677008449235^e1),
 -(1.8835101011^e0) + (5.02905719513^e1))

In [71]:
e0&(1/(a+b))&e0


Out[71]:
(0.275721749192^e0) - (0.677008449235^e1)

In [75]:
1/(a+b)


Out[75]:
(0.275721749192^e0) + (0.677008449235^e1)

In [74]:
a


Out[74]:
-(0.0951488812149^e0) + (0.18092211443^e1)

In [85]:
e0&a&e0&b, e0&b&e0&a


Out[85]:
(-0.254633999281 + (0.00723325957148^e01),
 -0.254633999281 + (0.00723325957148^e01))

In [87]:
a&e0&b


Out[87]:
-(0.254633999281^e0) + (0.00723325957148^e1)

In [ ]: